package cn.rongdao.jrkabao.model.cashadvance;

import com.mifengkong.frtools.http.request.HttpFunction;
import com.mifengkong.frtools.util.FRString;

import cn.rongdao.jrkabao.bean.cashadvance.CashByCreditCardBean;
import cn.rongdao.jrkabao.model.api.BaseKaMaoModel;
import io.reactivex.Observable;
import io.reactivex.Observer;

/**
 * Created by jack on 2017/6/3
 */

public class CashByCreditCardModel extends BaseKaMaoModel {

    public static CashByCreditCardModel getInstance() {
        return getPresent(CashByCreditCardModel.class);
    }

    public void execute(String institutionId, String isJiFen, Observer<CashByCreditCardBean> observer) {
        addParamStrings("institution_id", FRString.valueOf(institutionId));
        addParamStrings("is_jifen", FRString.isEmpty(isJiFen) ? "0" : FRString.valueOf(isJiFen));
        Observable<CashByCreditCardBean> observable = mServletApi.getDefaultCreditCard(mParams).map(new HttpFunction<CashByCreditCardBean>());
        toSubscribe(observable, observer);
    }

}
